<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="js/layer/css/layui.css">
    <link rel="stylesheet" type="text/css" href="css/admin.css">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <script>
        var searchFieldNum = 0;
    </script>
    <style>
        .toolbar-btn-action{
            float: left;
            padding-left: 15px;
        }
        .search-bar{
            float: right;
            padding-right: 15px;
        }
        .layui-btn + .layui-btn{
            margin-left: 0px;
        }
        #search-val{
            float: left;
            height: 36px;
            padding-left: 10px;
            border: 1px #eeeeee solid;
            display: inline!important;
        }
        #search-field{
            float: left;
            padding-left: 10px;
            height: 38px;
            background: #fff;
            border: 1px #eeeeee solid;
        }
    </style>
</head>

<body>
<div style="padding: 16px;"  id="view">

    <div class="layui-row layui-col-space15">

        <div class="layui-col-md12">

            <div class="layui-card">

                <div class="layui-tab layui-tab-brief" id="page-tab" lay-filter="test-hash" style="display: none">
                    {{#  if(d.tabs.length){ }}
                    <ul class="layui-tab-title"  style="padding-left:0px;">
                        {{#  arr_foreach(d.tabs, function(k1, v1){ }}
                        {{#  if(k1 == 0){ }}
                        <li class="layui-this" onclick="tabsLink(this)" data-where='{{v1.where}}'>{{v1.title}}</li>
                        {{# }else{ }}
                        <li  onclick="tabsLink(this)" data-where='{{v1.where}}'>{{v1.title}}</li>
                        {{#  } }}
                        {{#  }); }}
                    </ul>
                    {{#  } }}
                </div>
                <div class="layui-tab-content" style="margin-bottom: 30px;">

                    <div class="card-toolbar d-flex flex-column flex-md-row">
                        <div class="toolbar-btn-action"> <a style="color: #000;font-size: 16px;opacity: 0.7;line-height: 2.8em;">{{d.title}}</a>
                        </div>
                    </div>
                </div>
                <div class="layui-card-body">
                    <table id="laytable" lay-filter="laytable"></table>

                    <script id="left-toolbar" type="text/html">
                        <div class="layui-btn-container layui-btn-group">
                            {{#  arr_foreach(d.head_toolbar, function(k1, v1){ }}
                            {{#  if(v1.event != 'hidden'){ }}
                            <button data-config={{=json_encode(v1)}} class="layui-btn layui-btn-primary layui-btn-sm head-event" lay-event="header"><i class="layui-icon">{{-v1.ico}}</i>{{v1.title}}</button>
                            {{#  } }}
                            {{#  }); }}
                        </div>
                    </script>

                </div>

            </div>

        </div>

    </div>

</div>

<script type="text/javascript" src="js/layer/layui.js"></script>
<script>
    var where = {};
    var tabWhere = [];
    window.zhanshop = null;
    ready(function() {
        layui.use(['zhanshopTreeTable', 'zhanshop'], function() {
            zhanshop = layui.zhanshop;
            var treeTable = layui.zhanshopTreeTable;
            // view: function(url, elem, callback, reqMethod = 'POST', data = '', head = {}){
            zhanshop.view(API_ADDRESS + apiUrlTable+ "/" + zhanshop.getParam('_id'), '#view', function(
                data) {
                zhanshop.table.url = API_ADDRESS + apiUrlTable+ "/" + zhanshop.getParam('_id');
                zhanshop.table.title = data.title;
                zhanshop.table.elem = '#laytable';
                zhanshop.table.toolbar = '#left-toolbar';
                zhanshop.table.rowbar = data.row_toolbar; // 配置行级别菜单
                /**/
                zhanshop.table.width = data.width;
                zhanshop.table.height = data.height;
                zhanshop.table.even = data.even;
                zhanshop.table.skin = data.skin;
                zhanshop.table.css = data.css;
                zhanshop.table.size = data.size;
                zhanshop.table.limit = data.limit;
                zhanshop.table.limits = data.limits;
                zhanshop.table.lineStyle = data.lineStyle;
                zhanshop.table.cellMinWidth = data.cellMinWidth;
                zhanshop.table.data = data.data;
                /**/
                zhanshop.table.idName = data.pk;
                zhanshop.table.titleName = data.title_name;
                zhanshop.table.pidName = data.pid_name;
                zhanshop.table.schma = data.cols;
                zhanshop.table.searchPage = data.searchpage;
                window.colsData = [{type: 'checkbox'}];
                if(data.treeCustomName) zhanshop.table.treeCustomName = data.treeCustomName;
                for(var i in data.cols){
                    if(data.cols[i]['in_list'] !== false){
                        colsData.push(treeTable.laycols(data.cols[i]));
                    }
                }
                treeTable.render(colsData);
            }, 'POST', {"_method":"render"});
        });
    });
</script>
</body>
</html>
